#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Created by master on 2017/2/28

li = [10, 4, 33, 21, 54, 3, 8, 11, 5, 22, 2, 1, 17, 3, 6, 54]
count = 0;


def swap(a, b):
    if a > b:
        a, b = b, a


'''

for i in range(len(li)):
    for j in range(i, len(li)):
        count += 1
        print("----%d" % count)
        if li[i] > li[j]:
            li[i], li[j] = li[j], li[i]
        j += 1
    i += 1
'''
'''
for j in range(len(li)):
    for i in range(len(li)-1):
        count += 1
        print("----%d", count)
        if li[i] > li[i+1]:
            li[i], li[i+1] = li[i+1], li[i]
'''

for i in range(len(li) - 2):
    for j in range(len(li) - i - 1):
        print("----%d", count)
        if li[j] > li[j + 1]:
            li[j], li[j + 1] = li[j + 1], li[j]
        count += 1
print(li)
